package com.qf.controller;


import com.qf.pojo.response.BaseResult;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;


    @RequestMapping(value = "/sendMail", method = RequestMethod.GET)
    public BaseResult sendMail(@RequestParam("email")String email){
        return userService.sendMail(email);
    }

    @RequestMapping(value = "/loginOrRegistry", method = RequestMethod.POST)
    public BaseResult loginOrRegistry(@RequestBody Map map){
        return userService.loginOrRegistry(map);
    }

    @RequestMapping(value = "/loginByPassword", method = RequestMethod.POST)
    public BaseResult loginByPassword(@RequestBody Map map){
        return userService.loginByPassword(map);
    }

    @RequestMapping(value = "/findMyInfo", method = RequestMethod.POST)
    public BaseResult findMyInfo(HttpServletRequest request){
        return userService.findMyInfo(request);
    }
}
